package com.wisezone.demo0217;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class TestPerson {
    public static void main(String[] args) {
//        Person person = new Person(88);
        try {
            Class<?> c1 = Class.forName("com.wisezone.demo0217.Person");
            Constructor<?> constructor = c1.getDeclaredConstructor(int.class);
            constructor.setAccessible(true);
            Object person =constructor.newInstance(80);
            System.out.println(person);

        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }
}
